package com.iter.devbox.servlet3;

import java.io.IOException;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;

@WebFilter(filterName="myServletFilter", urlPatterns={"/myServlet3"}, servletNames={"myServlet3"}, dispatcherTypes=DispatcherType.REQUEST,
initParams={@WebInitParam(name="username", value="hnylj", description="this is initParam")}, asyncSupported=true, description="this is filter", displayName="myServletFilter") 
public class MyServletFilter implements Filter {

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		System.out.println(filterConfig.getFilterName());
		System.out.println(filterConfig.getInitParameter("username"));
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		System.out.println("filter......");
	}

	@Override
	public void destroy() {
	}
}
